<div class="recommendBox mt20 click-tabs">
	<div class="hd tabs-nav">
		<ul class="hp-tabs">
			<li class="current tab-b">
				最近浏览
			</li>
			<li class="tab-b tab-b">
				猜您喜欢
			</li>
			<li class="tab-b">
				我的收藏
			</li>
		</ul>
	</div>
	<div class="bd tabs-cont">
		<div class="recommentCont tab-c current">
			<div class="trigger prev">
				<i><</i>
			</div>
			<div class="recommentList">
				<div class="rlist history"></div>
			</div>
			<div class="trigger next">
				<i>></i>
			</div>
		</div>
		<div class="recommentCont tab-c">
			<div class="trigger prev">
				<i><</i>
			</div>
			<div class="recommentList">
				<div class="rlist">
					[@b2c_goods_list cateCode = itemCateCode count=10]
					[#list goodsList as goods]
					[#if goods_index%5 = 0]
					<ul>
						[/#if]
						<li>
							<p class="img">
								<a title="${goods.name}" target="_blank" href="${goods.path}"> <img class="lazy" data-original="[@Pic pic=goods.image_default postfix='160x160'/]" postfix="160x160" width="160" height="160"> </a>
							</p>

							<p class="price">
								<strong>${currency(goods.marketPrice, true)}</strong>
							</p>

							<p class="title">
								${goods.name}
							</p>
						</li>
						[#if (goods_index+1)%5==0 || goods_index=goodsList?size]
					</ul>
					[/#if]
					[/#list]
					[/@b2c_goods_list]
				</div>
			</div>
			<div class="trigger next">
				<i>></i>
			</div>
		</div>
		<div class="recommentCont tab-c">
			<div class="trigger prev">
				<i><</i>
			</div>
			<div class="recommentList">
				<div class="rlist">
					[#list favoriteList as goods]
					[#if goods_index%5 = 0]
					<ul>
						[/#if]
						<li>
							<p class="img">
								<a title="${goods.name}" target="_blank" href="${goods.path}"> <img class="lazy" data-original="[@Pic pic=goods.image_default postfix='160x160'/]" postfix="160x160" width="160" height="160"> </a>
							</p>

							<p class="price">
								<strong>${currency(goods.marketPrice, true)}</strong>
							</p>

							<p class="title">
								${goods.name}
							</p>
						</li>
						[#if (goods_index+1)%5==0 || goods_index=favoriteList?size]
					</ul>
					[/#if]
					[/#list]
				</div>
			</div>
			<div class="trigger next">
				<i>></i>
			</div>
		</div>
	</div>
</div>
<script>
    (function() {
        $(function() {
            //加载浏览历史
            loadHistory();

            $('.click-tabs').click(function(e) {
            	$(this).find('img.lazy').lazyload({skip_invisible: false});
                return fTabCut.call(this, e);
            });
            return $('.recommentCont').each(function(i) {
                var data, out, over, r, slidey;
                r = $(this).find('.recommentList');
                slidey = r.unslider({
                    items: '.rlist',
                    item: 'ul'
                });
                data = slidey.data('unslider');
                over = function() {
                    return data.stop();
                };
                out = function() {
                    data.stop();
                    return data.play();
                };
                return $(this).find('.prev').click(function() {
                    return data.prev();
                }).end().find('.next').click(function() {
                    return data.next();
                }).end().hover(over, out);
            });
        });

    }).call(this);

	//加载浏览历史
	function loadHistory(){
        ajax({
            url: base + "/history.jhtml",
            showError: true,
            async:false,
            cache: false,
            success: function(data){
                var html = template('history', {"list":data});
				$('.rlist.history').html(html);
				$('.rlist.history img.lazy').lazyload({threshold:500,failure_limit:20});
            }
        });
	}
</script>

<script id="history" type="text/html">
	{{if list.length > 0}}
		{{each list}}
			{{if $index%5 == 0}}
			<ul>
			{{/if}}
				<li>
					<p class="img"><a title="{{$value.name}}" target="_blank" href="{{$value.path}}"><img class="lazy" data-original="{{$value.image_default}}" postfix="160x160" width="166" height="166"></a>
					</p>

					<p class="price"><strong>{{$value.price | currency:'2'}}</strong></p>

					<p class="title"><a target="_blank" href="{{$value.path}}">{{$value.name}}</a></p>
				</li>
			{{if ($index+1)%5 == 0  || $index == list.length}}
			</ul>
			{{/if}}
		{{/each}}
	{{else}}
		<ul>
			<li>无浏览记录，去商城逛逛吧</li>
		</ul>
	{{/if}}
</script>